/*
 * @Author: kenan
 * @Date: 2022-04-12 15:26:02
 * @LastEditors: Jason Chen
 * @LastEditTime: 2022-12-05 10:57:15
 * @FilePath: /changeDbPassword/server/source/example/file_mysql.go
 * @Description:
 *
 * Copyright (c) 2022 by kenanlu@leansoftx.com, All Rights Reserved.
 */
package example

import (
	"github.com/flipped-aurora/gin-vue-admin/server/global"
	"github.com/flipped-aurora/gin-vue-admin/server/model/example"
	"github.com/pkg/errors"
	"gorm.io/gorm"
)

var FileMysql = new(fileMysql)

type fileMysql struct{}

func (f *fileMysql) TableName() string {
	return "exa_file_upload_and_downloads"
}

func (f *fileMysql) Initialize() error {

	return nil
}

func (f *fileMysql) CheckDataExist() bool {
	if errors.Is(global.GVA_DB.Where("`name` = ? AND `key` = ?", "logo.png", "1logo.png").First(&example.ExaFileUploadAndDownload{}).Error, gorm.ErrRecordNotFound) {
		return false
	}
	return true
}
